package com.lenovo.study.core.servlet;


import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Author: fuxh3@lenovo.com
 * Date: Created in 2017/8/23 0023
 */
@WebServlet(urlPatterns = "/lenovo",name = "customServlet")
public class CustomServlet extends HttpServlet{
    private static final Logger logger = LogManager.getLogger(CustomServlet.class);
    @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp)
                                    throws ServletException, IOException {
        doPost(req,resp);
    }

    @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp)
                                    throws ServletException, IOException {
        logger.info("进入到自定义的servlet中了");
        resp.getWriter().write("hello world");
    }
}
